import {camelCase, upperFirst } from 'lodash'
import {isExternal} from './validate.js'

/**
 * @description 动态路由 path 转 name
 * @demo /system => System
 * @demo /system/menu => SystemMenu
 * @demo /data-manage/detail => DataManageDetail
 */
export const transformPathToName = (path) => {
    if (!path) return ''
    if (isExternal(path)) return ''
    return upperFirst(camelCase(path))
}
